package dujiu.leetcode.greed;

import java.util.Arrays;

public class P1833 {
    public int maxIceCream(int[] costs, int coins) {
        int count = 0;
        Arrays.sort(costs);
        if (coins == 0){
            return 0;
        }
        for (int cost : costs) {
            if (coins >= cost){
                coins -= cost;
                count++;
            }
        }
        return count;
    }
}
